//#include "../SYSTEM/sys.h"             // Component selection
#include "LED.h"

/*LED2(D2)-->PB2
  高电平触发
*/

void LED_Init(void)
{
	GPIO_InitTypeDef GPIOInitStructure;
	
	GPIO_StructInit(&GPIOInitStructure);
	RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);//开启PA的时钟
	
	GPIOInitStructure.GPIO_Pin = GPIO_Pin_2;
	GPIOInitStructure.GPIO_Mode = GPIO_Mode_OUT;
	GPIOInitStructure.GPIO_OType = GPIO_OType_PP;
	GPIOInitStructure.GPIO_PuPd = GPIO_PuPd_UP;
	GPIOInitStructure.GPIO_Speed = GPIO_Speed_100MHz;
	
	GPIO_Init(GPIOB, &GPIOInitStructure);
	GPIO_ResetBits(GPIOB, GPIO_Pin_2);

}                   

void LED_On(LEDX_TypeDef LEDX)
{
	if (LEDX == LED2) {
        GPIO_SetBits(GPIOB, GPIO_Pin_2);
    }
}

void LED_Off(LEDX_TypeDef LEDX)
{
	if (LEDX == LED2) {
        GPIO_ResetBits(GPIOB, GPIO_Pin_2);
    }
}

void LED_Toggle(LEDX_TypeDef LEDX)
{
    if (LEDX == LED2) {
        GPIO_ToggleBits(GPIOB, GPIO_Pin_2);
    }
}
      
